<template>
	<view class="detail">
		<view class="detail-top">
			<view class="user flex-between">
				<view class="info flex-center-column">
					<view class="avatar">
						<image src="/static/1.jpg" mode="aspectFill"></image>
						<view class="label flex-center">交易员</view>
					</view>
					<view class="name">比特领航员</view>
					<view class="flex">
						<view class="sex flex-center">
							<text v-if="true">♂</text>
							<text v-else>♀</text>
						</view>
						<text>中国澳门</text>
					</view>
				</view>
				<view class="right flex">
					<view class="btn red flex-center">跟随</view>
					<view class="btn flex-center">
						<text v-if="true">已关注</text>
						<text v-else>关注</text>
					</view>
				</view>
			</view>
			<view class="next">
				<view class="num flex">
					<view>
						关注 <text>6</text>
					</view>
					<view>
						粉丝 <text>666</text>
					</view>
				</view>
				<view class="p">用心过程看透未来</view>
			</view>
		</view>
		<view class="box">
			<view class="tabs flex-between" :style="pos">
				<view class="flex-center" :class="{active:tabIndex == 0}" @click="changeTab(0)">动态</view>
				<view class="flex-center" :class="{active:tabIndex == 1}" @click="changeTab(1)">账户</view>
				<view class="flex-center" :class="{active:tabIndex == 2}" @click="changeTab(2)">交易</view>
				<view class="flex-center" :class="{active:tabIndex == 3}" @click="changeTab(3)">跟随者</view>
			</view>
		</view>

		<view class="content">
			<!-- 动态 -->
			<view class="card1" v-if="tabIndex == 0">
				<block v-for="(item,index) in 3" :key="index">
					<view class="card">
						<view class="top flex-between">
							<view class="left flex">
								<image src="/static/1.jpg" mode="aspectFill"></image>
								<view class="user">
									<view class="name">比特领航员</view>
									<view class="time">2021-04-21 14:31:01</view>
								</view>
							</view>
							<view class="right flex-center" :class="{active:index % 2 == 0}">关注</view>
						</view>
						<view class="content">就是立刻搭街坊是可见的就开始基地上空的飞机加快速度JFK就是打开飞机喀什地方就是看到</view>
						<view class="imgs flex">
							<block v-for="(v,k) in index+1 " :key="k">
								<image src="/static/1.jpg" mode="aspectFill"></image>
							</block>

						</view>
						<view class="bottom flex-between">
							<view class="flex-center">
								<image src="/static/share.png" mode="widthFix"></image>
								分享
							</view>
							<view class="flex-center">
								<image src="/static/comment.png" mode="widthFix"></image>
								评论
							</view>
							<view class="flex-center">
								<image src="/static/heart.png" mode="widthFix"></image>
								99
							</view>
						</view>
					</view>
				</block>

			</view>
			<!-- 账户 -->
			<view class="card2" v-if="tabIndex == 1">
				<view class="account">
					<view class="title flex-between">
						<view class="h3">交易账户</view>
						<view class="p flex">
							切换
							<image src="/static/arrow.png" mode="widthFix"></image>
						</view>
					</view>
					<view class="flex-between account-card">
						<view class="left flex">
							<view class="img flex-center">
								<image src="/static/1.jpg" mode="aspectFill"></image>
							</view>
							<view class="name flex">
								OKEX
								<text>交易员</text>
							</view>
						</view>
						<view class="right flex">
							<view class="r-left">
								<view class="h3">USDT</view>
								<text>USDT合约</text>
							</view>
							<image src="/static/arrow.png" mode="widthFix" class="r-right"></image>
						</view>
					</view>
				</view>
				<view class="data">
					<view class="title flex-between">
						<view class="h3">合约数据</view>
						<view class="p flex">
							更多
							<image src="/static/arrow.png" mode="widthFix"></image>
						</view>
					</view>
					<view class="flex-between data-box">
						<view>
							<view class="h4">114.23%</view>
							<text>收益率</text>
						</view>
						<view>
							<view class="h4">15458.1254</view>
							<text>总收益(USDT)</text>
						</view>
						<view>
							<view class="h4">14.23%</view>
							<text>交易胜率</text>
						</view>
						<view>
							<view class="h4">1345.4585</view>
							<text>账户余额</text>
						</view>
						<view>
							<view class="h4">12451.1255</view>
							<text>账户净值</text>
						</view>
						<view>
							<view class="h4">4.3100</view>
							<text>浮动盈亏</text>
						</view>
					</view>
				</view>
			</view>
			<!-- 交易 -->
			<view class="card3" v-if="tabIndex == 2">
				<view class="card3-tabs flex">
					<view :class="{active:tradeIndex == 0}" @click="changeTrade(0)">正在持仓</view>
					<view :class="{active:tradeIndex == 1}" @click="changeTrade(1)">历史记录</view>
				</view>
				<block v-for="(item,index) in 5" :key="index">
					<view class="card">
						<view class="top flex-between">
							<view>
								<view class="h5">BTC</view>
								<view class="p flex">
									<view>平空</view>500038.2356
								</view>
							</view>
							<view>
								<view class="text">持仓量</view>
								<view class="h5">
									500038.2356
								</view>
							</view>
							<view>
								<view class="text">收益USDT/率</view>
								<view class="h5 green">
									50.2356
								</view>
							</view>
						</view>
						<view class="bottom flex-between">
							<text>2021-04-25</text>
							<view class="h5 green">89.35%</view>
						</view>
					</view>
				</block>
			</view>
			<!-- 跟随者 -->
			<view class="card4" v-if="tabIndex == 3">
				<block v-for="(item,index) in 5" :key="index">
					<view class="card">
						<view class="flex-between top">
							<view class="left flex">
								<image src="/static/1.jpg" mode="aspectFill"></image>
								<view class="h3">烟雨离殇</view>
							</view>
							<view class="center">
								<text>跟随收益/策略</text>
							</view>
							<view class="right">
								<text>跟随交易额/笔</text>
							</view>
						</view>
						<view class="flex-between middle">
							<view class="left h3">OKEX账户</view>
							<view class="center green">30125.1235</view>
							<view class="right h3">2145425.344561</view>
						</view>
						<view class="flex-between bottom">
							<view class="left"><text>跟随USDT</text></view>
							<view class="center">正向5.0倍</view>
							<view class="right h3">444</view>
						</view>
					</view>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabIndex: 3,
				pos: '',
				tradeIndex:0
			}
		},
		 
		methods: {
			changeTab(i) {
				this.tabIndex = i;
			},
			changeTrade(i){
				this.tradeIndex = i;
			}
		},
		onPageScroll(e) {
			console.log(e)
			if (e.scrollTop >= 202) {
				this.pos = 'position:fixed'
			} else {
				this.pos = 'position:static'
			}
		}
	}
</script>

<style lang="less">
	@color: #d4237a;

	.detail {
		.detail-top {
			padding: 20rpx 24rpx;
			background: white;
			height: 404rpx;
			box-sizing: border-box;

			.user {
				align-items: flex-start;

				.info {
					.avatar {
						position: relative;

						image {
							width: 150rpx;
							height: 150rpx;
							border-radius: 50%;
							vertical-align: top;
						}

						view {
							position: absolute;
							bottom: 0;
							right: 0rpx;
							color: #fff;
							font-size: 20rpx;
							background: @color;
							padding: 10rpx 20rpx;
							font-style: oblique;
							border-radius: 30rpx 0 30rpx 0;
							// transform: scale(.7);
						}
					}

					.name {
						font-size: 32rpx;
						font-weight: bold;
						margin: 10rpx 0 5rpx;
					}

					.sex {
						width: 30rpx;
						height: 30rpx;
						border-radius: 50%;
						background: @color;
						margin-right: 3rpx;

						text {
							font-size: 20rpx;
							color: #fff;
							transform: scale(.8);
						}
					}

					text {
						font-size: 28rpx;
						color: #999;
					}
				}

				.right {
					height: 150rpx;

					.btn {
						width: 150rpx;
						height: 60rpx;
						border-radius: 30rpx;
						font-size: 30rpx;
						font-weight: bold;
						color: #999;
						border: 1px solid #ddd;
						margin-left: 30rpx;
					}

					.red {
						background: @color;
						color: #fff;
						width: 250rpx;
					}
				}
			}

			.next {
				line-height: 1.8;
				padding-top: 10rpx;

				.num {
					font-size: 26rpx;
					color: #999;

					view {
						margin-right: 30rpx;
					}

					text {
						font-size: 32rpx;
						color: #000;
					}
				}

				.p {
					font-size: 26rpx;
					color: #999;
				}
			}
		}

		.box {
			width: 100vw;
			height: 70rpx;
			
			.tabs {
				background: white;
				padding: 0 24rpx 10rpx;
				position: static;
				top: 0;
				left: 0;
				width: 100vw;
				height: 70rpx;
				box-sizing: border-box;
				z-index: 10;
			
				view {
					width: 20%;
					height: 60rpx;
					font-weight: bold;
					font-size: 30rpx;
					color: #666;
			
				}
			
				.active {
					color: #000;
					position: relative;
			
					&::after {
						content: "";
						display: block;
						width: 20rpx;
						height: 4rpx;
						background: @color;
						position: absolute;
						bottom: 0;
						left: calc(50% - 10rpx);
					}
				}
			}
			
		}

		.content {
			padding: 24rpx;

			.card1 {
				.card {
					background: white;
					padding: 20rpx;
					border-radius: 10rpx;
					margin-bottom: 30rpx;

					.top {
						.left {
							image {
								width: 80rpx;
								height: 80rpx;
								border-radius: 50%;
								margin-right: 20rpx;
							}

							.name {
								font-size: 28rpx;
							}

							.time {
								font-size: 20rpx;
								color: #999;
							}
						}

						.right {
							font-size: 26rpx;
							color: #f0f;
							border: 1px solid #f0f;
							height: 50rpx;
							padding: 0 25rpx;
							border-radius: 25rpx;

							&.active {
								background: #f0f;
								color: white;
							}
						}
					}

					.content {
						font-size: 26rpx;
						padding: 15rpx 0;
						line-height: 1.5;
					}

					.imgs {
						image {
							width: 200rpx;
							height: 200rpx;
							margin-right: 22rpx;
							border-radius: 10rpx;

							&:last-child {
								margin-right: 0;
							}
						}
					}

					.bottom {
						margin-top: 20rpx;

						view {
							width: 25%;
						}

						image {
							width: 36rpx;
							height: auto;
							margin-right: 10rpx;
						}
					}
				}

			}

			.card2 {
				.title {
					margin-bottom: 20rpx;

					.h3 {
						font-weight: bold;
						font-size: 32rpx;
					}

					.p {
						font-size: 30rpx;
						color: #999;
					}

					image {
						margin-left: 10rpx;
						width: 28rpx;
						height: 28rpx
					}
				}

				.account {
					background: white;
					padding: 24rpx;

					.account-card {
						background: #eee;
						padding: 20rpx;
						border-radius: 10rpx;

						.img {
							width: 100rpx;
							height: 100rpx;
							background: white;
							border-radius: 15rpx;
							overflow: hidden;

							image {
								width: 100%;
								height: 100%;
							}
						}

						.name {
							font-size: 32rpx;
							font-weight: bold;
							margin-left: 15rpx;

							text {
								font-size: 24rpx;
								font-weight: normal;
								color: #999;
								margin-left: 10rpx;
							}
						}

						.right {
							.r-left {
								text-align: right;
								margin-right: 20rpx;

								view {
									font-size: 30rpx;
								}

								text {
									font-size: 24rpx;
									color: #999;
								}
							}

							.r-right {
								width: 24rpx;
								height: auto;
								transform: rotate(90deg);
							}
						}
					}
				}
				.data{
					background: white;
					padding: 24rpx;
					margin: 24rpx 0;
					.data-box{
						flex-wrap: wrap;
						&>view{
							width: 31%;
							line-height: 1;
							padding: 15rpx 0;
							.h4{
								font-size: 28rpx;
								font-weight: bold;
							}
							text{
								font-size: 24rpx;
								color:#999;
							}
							&:nth-child(3n){
								text-align: right;
							}
							&:nth-child(3n+2){
								text-align: center;
							}
						}
					}
				}
				
			}
			.card3{
				.card3-tabs{
					view{
						font-size: 28rpx;
						font-weight: bold;
						color:#777;
						margin-right: 40rpx;
						padding-bottom: 20rpx;
						&.active{
							color:#000;
						}
					}
				}
				.card{
					background: white;
					padding:10rpx 20rpx;
					border-radius: 15rpx;
					margin-bottom: 30rpx;
					font-size: 26rpx;
					line-height: 2;
					.h5{
						font-weight: bold;
					}
					.text{
						color:#666;
					}
					.green{
						color:#4CD964
					}
					text{
						color:#888;
					}
					.p{
						view{
							color:#DD524D;
							font-weight: bold;
						}
					}
					.top{
						&>view{
							&:nth-child(2){
								text-align: center;
							}
							&:nth-child(3){
								text-align: right;
							}
						}
					}
				}
			}
			.card4{
				.card{
					background: white;
					padding: 20rpx;
					border-radius: 10rpx;
					margin-bottom: 30rpx;
					line-height: 2;
					font-size: 26rpx;
					image{
						width: 70rpx;
						height: 70rpx;
						border-radius: 50%;
						margin-right: 10rpx;
					}
					.h3{
						
						font-weight: bold;
					}
					text{
						color:#999;
					}
					.left{
						width:32% ;
					}
					.center{
						width: 30%;
						text-align: center;
					}
					.right{
						width: 34%;
						text-align: right;
					}
					.top{
						margin-bottom: 10rpx;
					}
				}
			}
		}
	}
</style>
